package com.ctshk.rpc.custom.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.custom.base.CustomBaseMapper;
import com.ctshk.rpc.custom.dto.insurance.TripScheduleInsuranceDTO;
import com.ctshk.rpc.custom.entity.CustomizedTripScheduleInsurance;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 保险计划 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-20
 */
public interface CustomizedTripScheduleInsuranceMapper extends CustomBaseMapper<CustomizedTripScheduleInsurance> {

    /**
     * 获取团期保险计划
     * @param scheduleId
     * @return
     */
    @Select("SELECT a.insurance_id AS id,a.`name`,b.company_name AS companyName\n" +
            "FROM t_customized_trip_schedule_insurance a LEFT JOIN t_insurance b ON a.insurance_id = b.id\n" +
            "WHERE a.schedule_id = #{schedule_id} and a.is_deleted = 0 ORDER BY a.gmt_create ASC")
    List<TripScheduleInsuranceDTO> queryListBySchedule(@Param("schedule_id") Long scheduleId);
}
